﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using UAC;
using UAC.Operation;

namespace UACManager
{
    public partial class TeamDefForm : Form
    {
        public TeamDefForm()
        {
            InitializeComponent();
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            string _teamDefId = this.tTeamDefID.Text;
            string _targetDesc = this.tTargetDesc.Text;
            string _description = this.tDesc.Text;

            if (string.IsNullOrEmpty(_teamDefId) || string.IsNullOrEmpty(_description))
            {
                MessageBox.Show("为空！", "警告");
                return;
            }
            int teamDefId;
            if (!int.TryParse(_teamDefId, out teamDefId))
            {
                MessageBox.Show("TeamDefID格式错误！", "警告");
                return;
            }
            try
            {
                Utils.CreateTeamDef(teamDefId, _description, _targetDesc, true);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "警告");
                return;
            }
            this.DialogResult = System.Windows.Forms.DialogResult.OK;
        }
    }
}
